import { chain, isEmpty, isString } from 'lodash'

export default {
  method: 'post',
  url: '/api/logs/test_condition',
  transformParam: param => {
    const compactCondition = chain(param.condition)
      .toPairs()
      // eslint-disable-next-line
      .filter(([key, value]) => {
        return !isString(value) || !isEmpty(value)
      })
      .fromPairs()
      .value()
    return {
      ...param,
      condition: compactCondition,
    }
  },
}
